<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
       #mask{
           position: fixed;
           left:0;
           right:0;
           top:0;
           bottom:0;
           background: rgba(0,0,0,.2);
           display: flex;
           justify-content: center;
           align-items: center;
       }
       .content{
           width: 40%;
           height: 40%;
           background: #fff;
       }
    </style>
</head>
<body>
    <div id="app">
     <button @click="showModal">弹窗</button>
      <div id="mask" @click.self="hideModal" v-show="isShow">
          <div class="content">
              我是内容
              <p>dwhjodjwodw</p>
              <button>csieofjdm</button>
          </div>
      </div>
    </div>
    <script src="./vue.js"></script>
    <script>
        const vm = new Vue({
            el:"#app",
            data:{
                isShow: false
            },
            methods:{
                showModal(){
                    this.isShow = true
                },
                hideModal(){
                    this.isShow = false
                }
            }
        })
    </script>
</body>
</html>